﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightApplication1.DataTypes
{
    public class DTSearchCriteria
    {
        #region CONSTANTS
        public const int NOTHING = 0;
        //SORT BY
        public const int LST_PRICE_ASC = 1;
        public const int LST_PRICE_DSC = 2;
        public const int PUB_DATE = 3;
        public const int TITLE = 4;
        //CONDITION
        public const int COND_ALL = 5;
        public const int COND_USED = 0;
        public const int COND_COLLECTIBLE = 1;
        public const int COND_REFURBISHED = 2;
        #endregion

        #region FIELDS
        public bool isAdvanced { get; set; }
        public string mainKeywords { get; set; }
        public int sortBy { get; set; }
        public string author { get; set; }
        public string publisher { get; set; }
        public string title { get; set; }
        public int category { get; set; }
        public string condition { get; set; }   //"000" or "100" or "010" or "110" ...
        public string keywords { get; set; }
        public decimal maxPrice { get; set; }
        public decimal minPrice { get; set; }
        #endregion

        public DTSearchCriteria()
        {
            sortBy = NOTHING;
            author = "";
            publisher = "";
            title = "";
            category = NOTHING;
            condition = "000";
            keywords = "";
            maxPrice = 0;
            minPrice = 0;
        }

        public string GetCondition() {
            string result;

            switch (condition) { 
                case "100":
                    result = "Used";
                    break;
                case "010":
                    result = "Collectible";
                    break;
                case "001":
                    result = "Refurbished";
                    break;
                case "111":
                    result = "All";
                    break;
                default:
                    result = "New";
                    break;
            }

            return (result);
        }
    }
}
